home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / Found / BCCollec / Structs / Collects / BCCollD.cpp < prev    next >
Encoding:
Text File  |  1994-04-21  |  5.7 KB  |  218 lines  |  [TEXT/MPS ]

  1. //  The C++ Booch Components (Version 2.1)
  2. //  (C) Copyright 1990-1993 Grady Booch. All Rights Reserved.
  3. //
  4. //  Restricted Rights Legend
  5. //  Use, duplication, or disclosure is subject to restrictions as set forth 
  6. //  in subdivision (c)(1)(ii) of the Rights in Technical Data and Computer 
  7. //  Software clause at DFARS 252.227-7013. 
  8. //
  9. //  BCCollD.cpp
  10. //
  11. //  This file contains the definitions for the dynamic collection.
  12.  
  13. #include "BCCollD.h"
  14.  
  15. template<class Item, class StorageManager>
  16. BC_TDynamicCollection<Item, StorageManager>::BC_TDynamicCollection() {}
  17.  
  18. template<class Item, class StorageManager>
  19. BC_TDynamicCollection<Item, StorageManager>::BC_TDynamicCollection(BC_Index chunkSize)
  20.   : fRep(chunkSize) {}
  21.  
  22. template<class Item, class StorageManager>
  23. BC_TDynamicCollection<Item, StorageManager>::
  24.   BC_TDynamicCollection(const BC_TDynamicCollection<Item, StorageManager>& c)
  25.     : fRep(c.fRep) {}
  26.  
  27. template<class Item, class StorageManager>
  28. BC_TDynamicCollection<Item, StorageManager>::~BC_TDynamicCollection() {}
  29.  
  30. template<class Item, class StorageManager>
  31. BC_TCollection<Item>& BC_TDynamicCollection<Item, StorageManager>::
  32.   operator=(const BC_TCollection<Item>& c)
  33. {
  34.   return BC_TCollection<Item>::operator=(c);
  35. }
  36.  
  37. template<class Item, class StorageManager>
  38. BC_TCollection<Item>& BC_TDynamicCollection<Item, StorageManager>::
  39.   operator=(const BC_TDynamicCollection<Item, StorageManager>& c)
  40. {
  41.   fRep = c.fRep;
  42.   return *this;
  43. }
  44.  
  45. template<class Item, class StorageManager>
  46. BC_Boolean BC_TDynamicCollection<Item, StorageManager>::
  47.   operator==(const BC_TCollection<Item>& c) const
  48. {
  49.   return BC_TCollection<Item>::operator==(c);
  50. }
  51.  
  52. template<class Item, class StorageManager>
  53. BC_Boolean BC_TDynamicCollection<Item, StorageManager>::
  54.   operator==(const BC_TDynamicCollection<Item, StorageManager>& c) const
  55. {
  56.   return (fRep == c.fRep);
  57. }
  58.  
  59. template<class Item, class StorageManager>
  60. BC_Boolean BC_TDynamicCollection<Item, StorageManager>::
  61.   operator!=(const BC_TDynamicCollection<Item, StorageManager>& c) const
  62. {
  63.   return !operator==(c);
  64. }
  65.  
  66. template<class Item, class StorageManager>
  67. void BC_TDynamicCollection<Item, StorageManager>::SetChunkSize(BC_Index chunkSize)
  68. {
  69.   fRep.SetChunkSize(chunkSize);
  70. }
  71.  
  72. template<class Item, class StorageManager>
  73. const Item& BC_TDynamicCollection<Item, StorageManager>::operator[](BC_Index index) const
  74. {
  75.   return fRep[index];
  76. }
  77.  
  78. template<class Item, class StorageManager>
  79. Item& BC_TDynamicCollection<Item, StorageManager>::operator[](BC_Index index)
  80. {
  81.   return (Item&)(fRep[index]);
  82. }
  83.  
  84. template<class Item, class StorageManager>
  85. void BC_TDynamicCollection<Item, StorageManager>::Preallocate(BC_Index new_length)
  86. {
  87.   fRep.Preallocate(new_length);
  88. }
  89.  
  90. template<class Item, class StorageManager>
  91. void BC_TDynamicCollection<Item, StorageManager>::Clear()
  92. {
  93.   fRep.Clear();
  94. }
  95.  
  96. template<class Item, class StorageManager>
  97. void BC_TDynamicCollection<Item, StorageManager>::Insert(const Item& item)
  98. {
  99.   fRep.Insert(item);
  100. }
  101.  
  102. template<class Item, class StorageManager>
  103. void BC_TDynamicCollection<Item, StorageManager>::
  104.   Insert(const Item& item, BC_Index before)
  105. {
  106.   fRep.Insert(item, before);
  107. }
  108.  
  109. template<class Item, class StorageManager>
  110. void BC_TDynamicCollection<Item, StorageManager>::Append(const Item& item)
  111. {
  112.   fRep.Append(item);
  113. }
  114.  
  115. template<class Item, class StorageManager>
  116. void BC_TDynamicCollection<Item, StorageManager>::
  117.   Append(const Item& item, BC_Index after)
  118. {
  119.   fRep.Append(item, after);
  120. }
  121.  
  122. template<class Item, class StorageManager>
  123. void BC_TDynamicCollection<Item, StorageManager>::Remove(BC_Index at)
  124. {
  125.   fRep.Remove(at);
  126. }
  127.  
  128. template<class Item, class StorageManager>
  129. void BC_TDynamicCollection<Item, StorageManager>::Replace(BC_Index at, const Item& item)
  130. {
  131.   fRep.Replace(at, item);
  132. }
  133.  
  134. template<class Item, class StorageManager>
  135. BC_Index BC_TDynamicCollection<Item, StorageManager>::ChunkSize() const
  136. {
  137.   return fRep.ChunkSize();
  138. }
  139.  
  140. template<class Item, class StorageManager>
  141. BC_Index BC_TDynamicCollection<Item, StorageManager>::Length() const
  142. {
  143.   return fRep.Length();
  144. }
  145.  
  146. template<class Item, class StorageManager>
  147. BC_Boolean BC_TDynamicCollection<Item, StorageManager>::IsEmpty() const
  148. {
  149.   return (fRep.Length() == 0);
  150. }
  151.  
  152. template<class Item, class StorageManager>
  153. const Item& BC_TDynamicCollection<Item, StorageManager>::First() const
  154. {
  155.   return fRep.First();
  156. }
  157.  
  158. template<class Item, class StorageManager>
  159. Item& BC_TDynamicCollection<Item, StorageManager>::First()
  160. {
  161.   return (Item&)(fRep.First());
  162. }
  163.  
  164. template<class Item, class StorageManager>
  165. const Item& BC_TDynamicCollection<Item, StorageManager>::Last() const
  166. {
  167.   return fRep.Last();
  168. }
  169.  
  170. template<class Item, class StorageManager>
  171. Item& BC_TDynamicCollection<Item, StorageManager>::Last()
  172. {
  173.   return (Item&)(fRep.Last());
  174. }
  175.  
  176. template<class Item, class StorageManager>
  177. BC_ExtendedIndex BC_TDynamicCollection<Item, StorageManager>::
  178.   Location(const Item& item) const
  179. {
  180.   return fRep.Location(item);
  181. }
  182.  
  183. template<class Item, class StorageManager>
  184. void BC_TDynamicCollection<Item, StorageManager>::Purge()
  185. {
  186.   fRep.Clear();
  187. }
  188.  
  189. template<class Item, class StorageManager>
  190. void BC_TDynamicCollection<Item, StorageManager>::Add(const Item& item)
  191. {
  192.   fRep.Append(item);
  193. }
  194.  
  195. template<class Item, class StorageManager>
  196. BC_Index BC_TDynamicCollection<Item, StorageManager>::Cardinality() const
  197. {
  198.   return fRep.Length();
  199. }
  200.  
  201. template<class Item, class StorageManager>
  202. const Item& BC_TDynamicCollection<Item, StorageManager>::ItemAt(BC_Index index) const
  203. {
  204.   return fRep.ItemAt(index);
  205. }
  206.  
  207. template<class Item, class StorageManager>
  208. void* BC_TDynamicCollection<Item, StorageManager>::operator new(size_t s)
  209. {
  210.   return StorageManager::Allocate(s);
  211. }
  212.  
  213. template<class Item, class StorageManager>
  214. void BC_TDynamicCollection<Item, StorageManager>::operator delete(void* p, size_t s)
  215. {
  216.   StorageManager::Deallocate(p, s);
  217. }
  218.